package com.ailight.smart.ai.feign.impl;

import com.ailight.smart.ai.command.LightModelCommand;
import com.ailight.smart.ai.feign.LightApiFeignFacade;
import com.ailight.smart.ai.feign.client.LightApiFeignClient;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class LightApiFeignFacadeImpl implements LightApiFeignFacade {
    private final LightApiFeignClient lightApiFeignClient;

    @Override
    public String lightControl(LightModelCommand command) {
        return lightApiFeignClient.operationLight(command).getData();
    }

    @Override
    public String lightControl(String command) {
        if (command.equals("turn_light")) {
            return lightApiFeignClient.modifyLightState(0).getData();
        } else {
            return lightApiFeignClient.modifyLightState(1).getData();
        }
    }
}
